<div id="main">
    <div class="well">
        <div id="activation-alert">
            <h3 class="alert alert-info text-center">帐号绑定中...</h3>
        </div>
    </div>
</div>

<script>
    $(function () {
        toActivation();
    });

    function toActivation() {
        $.ajax({
            url: '<?php echo base_url('api/binduser');?>',
            type: 'post',
            data: {type:'weibo'},
            success: function (jsonrsp) {
                try {
                    var rsp = $.parseJSON(jsonrsp);
                    var _id_activation_alert = $('#activation-alert');
                    switch (rsp.type) {
                        case 'success':
                            _id_activation_alert.html('<h3 class="alert alert-success text-center">' + rsp.message + '</h3>');
                            window.location.href=base_url('');
                            break;
                        case 'warning':
                            _id_activation_alert.html('<h3 class="alert alert-warning text-center">' + rsp.message + '</h3>');
                            break;
                        default:
                            _id_activation_alert.html('<h3 class="alert alert-warning text-center">' + rsp.message + '</h3>');
                            break;
                    }
                } catch (ex) {
                    noty({type: 'error', text: '发生内部错误，请联系管理员'});
                    throw ex;
                }
            }
        });
    }
</script>